#ifndef __RECKON__IFILE_H__
#define __RECKON__IFILE_H__

#include "includes.h"

// currently... support only ANSI text file [4/11/2011 steve]

namespace reckon {

	class IFile
	{
	public:
		enum open_mode
		{
			mode_undefined = 0,
			mode_read,
			mode_write,
			mode_append,
		};

		enum file_encoding
		{
			ansi,
			binary,
		};
	public:
		virtual bool openToRead() = 0;	// uses encoding that file uses
		virtual bool openToWrite(IFile::file_encoding encoding = IFile::ansi) = 0;
		virtual bool openToAppend() = 0; // uses encoding that file uses

		virtual bool close() = 0;

		virtual file_encoding getEncoding() = 0;

	protected:
		IFile() {}
	public:
		virtual ~IFile() {}
	};

	class ITextFile : public IFile
	{
	public:
		virtual bool readLine(tstring& buf) = 0;
		virtual bool writeLine(const tstring& buf) = 0;


	protected:
		ITextFile() {}
	public:
		virtual ~ITextFile() {}

	};

	class IBinFile : public IFile
	{

	};

	typedef boost::shared_ptr<ITextFile>		TextFile;
	typedef boost::shared_ptr<IBinFile>			BinFile;

	namespace util
	{
		RECKON_API TextFile	createTextFile(LPCTSTR lpszPath);

		RECKON_API BinFile	createBinFile(LPCTSTR lpszPath);
	}

}

#endif // __RECKON__IFILE_H__